package com.netease.pris.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import com.netease.framework.ActivityEx;
import com.netease.framework.k;
import com.netease.pris.activity.a.g;
import com.netease.pris.activity.a.t;
import com.netease.pris.activity.view.NPullToFreshContainer;
import com.netease.pris.activity.view.NeteaseGridView;
import com.netease.pris.activity.view.NeteaseListView;
import com.netease.pris.activity.view.bn;
import com.netease.pris.app.PrisApp;
import com.netease.pris.atom.u;
import com.netease.pris.v;
import java.util.LinkedList;

public class SubsSourceActivity extends ActivityEx
{
  public static final int a = 0;
  public static final int b = 1;
  public static final int c = 4096;
  public static final int d = 1;
  private View A;
  private LinearLayout B;
  private ProgressBar C;
  private TextView D;
  private ProgressBar E;
  private LinearLayout F;
  private Button G;
  private LinearLayout H;
  private TextView I;
  private LinearLayout J;
  private Toast K;
  private View L;
  private String M = null;
  private AdapterView.OnItemClickListener N = new ag(this);
  boolean e = true;
  bn f = new ah(this);
  View.OnClickListener g = new af(this);
  AbsListView.OnScrollListener h = new ad(this);
  com.netease.pris.b i = new ae(this);
  private boolean j = false;
  private boolean k = false;
  private int l = 0;
  private int m = 0;
  private String n = null;
  private String o = null;
  private u p = null;
  private com.netease.pris.protocol.d q = null;
  private Context r = null;
  private ImageView s = null;
  private NeteaseListView t = null;
  private NeteaseGridView u = null;
  private NPullToFreshContainer v;
  private NPullToFreshContainer w;
  private BaseAdapter x = null;
  private LinkedList y;
  private LinkedList z;

  private void a(int paramInt, Object paramObject, String paramString1, String paramString2, boolean paramBoolean)
  {
    com.netease.pris.atom.b localb = com.netease.pris.atom.b.a;
    if (this.p != null)
      localb = this.p.be();
    switch (paramInt)
    {
    case 902:
    default:
      return;
    case 901:
    case 903:
    }
    for (this.l = v.a().a(paramString1, localb, this.p, paramBoolean); ; this.l = v.a().c(paramString1, localb))
    {
      this.z.add(new Integer(this.l));
      break;
    }
  }

  public static void a(Context paramContext, String paramString, u paramu)
  {
    PrisApp.a().a(paramu);
    Intent localIntent = new Intent(paramContext, SubsSourceActivity.class);
    localIntent.putExtra("url", paramString);
    paramContext.startActivity(localIntent);
  }

  private void a(com.netease.pris.protocol.d paramd, boolean paramBoolean)
  {
    if ((paramd == null) || (paramd.h == null));
    while (true)
    {
      return;
      switch (this.p.av())
      {
      default:
        break;
      case 256:
        if ((this.x == null) || (!(this.x instanceof t)))
          continue;
        if (paramBoolean)
        {
          this.y.addAll(paramd.h);
          ((t)this.x).a(paramd.h);
          this.x.notifyDataSetChanged();
          continue;
        }
        this.y.clear();
        this.y.addAll(paramd.h);
        ((t)this.x).a();
        ((t)this.x).b(paramd.h);
        this.t.setSelection(this.t.getHeaderViewsCount());
        this.x.notifyDataSetChanged();
        break;
      case 1024:
        if ((this.x == null) || (!(this.x instanceof com.netease.pris.activity.a.af)))
          continue;
        if (paramBoolean)
        {
          this.y.addAll(paramd.h);
          this.x.notifyDataSetChanged();
          continue;
        }
        this.y.clear();
        this.y.addAll(paramd.h);
        this.t.setAdapter(this.x);
        this.t.setSelection(this.t.getHeaderViewsCount());
        break;
      case 512:
        if ((this.x == null) || (!(this.x instanceof g)))
          continue;
        if (paramBoolean)
        {
          this.y.addAll(paramd.h);
          this.x.notifyDataSetChanged();
          continue;
        }
        this.y.clear();
        this.y.addAll(paramd.h);
        this.u.setAdapter(this.x);
        break;
      case 2048:
        if ((this.x == null) || (!(this.x instanceof com.netease.pris.activity.a.b)))
          continue;
        if (paramBoolean)
        {
          this.y.addAll(paramd.h);
          this.x.notifyDataSetChanged();
          continue;
        }
        this.y.clear();
        this.y.addAll(paramd.h);
        this.u.setAdapter(this.x);
      }
    }
  }

  private void b(boolean paramBoolean)
  {
    if (paramBoolean)
    {
      this.H.setVisibility(0);
      this.I.setText(2131361949);
    }
    while (true)
    {
      return;
      this.H.setVisibility(8);
    }
  }

  private void c()
  {
    this.s = ((ImageView)findViewById(2131558408));
    this.w = ((NPullToFreshContainer)findViewById(2131558652));
    this.t = ((NeteaseListView)findViewById(2131558529));
    this.w.a(this.f);
    this.u = ((NeteaseGridView)findViewById(2131558655));
    this.v = ((NPullToFreshContainer)findViewById(2131558654));
    this.v.a(this.f);
    this.A = LayoutInflater.from(this).inflate(2130903048, null);
    this.t.addFooterView(this.A);
    this.t.setDivider(null);
    this.t.setDividerHeight(0);
    this.t.setFooterDividersEnabled(false);
    this.B = ((LinearLayout)this.A.findViewById(2131558426));
    this.C = ((ProgressBar)this.A.findViewById(2131558427));
    this.D = ((TextView)this.A.findViewById(2131558428));
    this.F = ((LinearLayout)this.A.findViewById(2131558429));
    this.G = ((Button)this.A.findViewById(2131558432));
    this.E = ((ProgressBar)findViewById(2131558412));
    this.H = ((LinearLayout)findViewById(2131558656));
    this.I = ((TextView)findViewById(2131558658));
    this.J = ((LinearLayout)findViewById(2131558653));
    this.L = findViewById(2131558651);
  }

  private void c(boolean paramBoolean)
  {
    if (paramBoolean)
    {
      this.B.setVisibility(0);
      this.C.setVisibility(0);
      this.D.setText(2131361949);
    }
    while (true)
    {
      return;
      this.B.setVisibility(8);
    }
  }

  private void d(boolean paramBoolean)
  {
    if (paramBoolean)
      this.F.setVisibility(0);
    while (true)
    {
      return;
      this.F.setVisibility(8);
    }
  }

  private void e()
  {
    setTitle(this.p.U());
    f(2130837818);
    this.s.setVisibility(8);
    this.E.setVisibility(0);
  }

  private void f()
  {
    switch (this.p.av())
    {
    default:
    case 256:
    case 1024:
    case 512:
    case 2048:
    }
    while (true)
    {
      return;
      String[] arrayOfString = new String[5];
      arrayOfString[0] = "icon";
      arrayOfString[1] = "title";
      arrayOfString[2] = "time";
      arrayOfString[3] = "content";
      arrayOfString[4] = "line";
      int[] arrayOfInt = new int[4];
      arrayOfInt[0] = 2131558436;
      arrayOfInt[1] = 2131558424;
      arrayOfInt[2] = 2131558660;
      arrayOfInt[3] = 2131558525;
      this.x = new t(this, 2130903110, arrayOfString, arrayOfInt);
      this.t.setAdapter(this.x);
      this.w.setVisibility(0);
      this.t.setVisibility(0);
      this.u.setVisibility(8);
      continue;
      com.netease.pris.activity.a.af localaf = new com.netease.pris.activity.a.af(this);
      localaf.a(this.y);
      this.x = localaf;
      this.t.setAdapter(this.x);
      this.w.setVisibility(0);
      this.t.setVisibility(0);
      this.u.setVisibility(8);
      continue;
      this.J.setBackgroundColor(k.a(this).c(2131230892));
      g localg = new g(this);
      this.u.setAdapter(localg);
      localg.a(this.y);
      this.x = localg;
      int i3 = com.netease.image.c.a(this.r, 8.0F);
      this.u.setVerticalSpacing(i3);
      int i4 = com.netease.image.c.a(this.r, 8.0F);
      this.u.setHorizontalSpacing(i4);
      this.u.setPadding(i4, 0, i4, 0);
      this.u.setSelector(2130837752);
      this.w.setVisibility(8);
      this.t.setVisibility(8);
      this.u.setVisibility(0);
      continue;
      com.netease.pris.activity.a.b localb = new com.netease.pris.activity.a.b(this);
      this.u.setAdapter(localb);
      localb.a(this.y);
      this.x = localb;
      int i1 = com.netease.image.c.a(this.r, 16.0F);
      this.u.setVerticalSpacing(i1);
      int i2 = com.netease.image.c.a(this.r, 12.0F);
      this.u.setHorizontalSpacing(i2);
      this.u.setPadding(i2, 0, i2, 0);
      this.u.setSelector(2130837627);
      this.t.setVisibility(8);
      this.w.setVisibility(8);
      this.u.setVisibility(0);
    }
  }

  private void g()
  {
    if (this.s != null)
      this.s.setOnClickListener(this.g);
    if (this.G != null)
      this.G.setOnClickListener(this.g);
    if (this.t != null)
    {
      this.t.setOnItemClickListener(this.N);
      this.t.setOnScrollListener(this.h);
    }
    if (this.u != null)
    {
      this.u.setOnItemClickListener(this.N);
      this.u.setOnScrollListener(this.h);
    }
  }

  private void h()
  {
    this.s.setVisibility(8);
    this.E.setVisibility(0);
    d(false);
    this.j = true;
    a(901, null, this.n, null, false);
  }

  private void r()
  {
    if ((this.o != null) && (!this.j))
    {
      this.j = true;
      a(903, null, this.o, null, false);
      c(true);
      b(true);
      this.s.setVisibility(8);
      this.E.setVisibility(0);
    }
  }

  void a()
  {
    this.e = false;
  }

  void b()
  {
    this.e = true;
  }

  protected void onActivityResult(int paramInt1, int paramInt2, Intent paramIntent)
  {
    switch (paramInt1)
    {
    default:
    case 4096:
    }
    while (true)
    {
      return;
      if ((paramInt2 == -1) && (paramIntent != null))
      {
        Bundle localBundle = paramIntent.getExtras();
        if (localBundle == null)
          continue;
        this.m = localBundle.getInt("position");
        this.o = localBundle.getString("nexturl");
        this.k = true;
        continue;
      }
    }
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    Intent localIntent = getIntent();
    if (localIntent != null)
      this.n = localIntent.getStringExtra("url");
    this.p = PrisApp.a().q();
    setContentView(2130903108);
    this.r = this;
    this.y = new LinkedList();
    this.z = new LinkedList();
    v.a().a(this.i);
    c();
    f();
    g();
    e();
    this.j = true;
    a(901, null, this.n, null, true);
    this.M = getString(2131362298);
  }

  public boolean onCreateOptionsMenu(Menu paramMenu)
  {
    getMenuInflater().inflate(2131492872, paramMenu);
    return super.onCreateOptionsMenu(paramMenu);
  }

  public void onDestroy()
  {
    super.onDestroy();
    v.a().b(this.i);
    if (this.i != null)
    {
      this.i.c();
      this.i = null;
    }
    if (this.E != null)
      this.E.setVisibility(8);
    if (this.C != null)
      this.C.setVisibility(8);
    if (this.x != null)
    {
      if ((this.x instanceof t))
        ((t)this.x).a();
      this.x = null;
    }
    if (this.q != null)
      this.q = null;
    if (this.y != null)
    {
      this.y.clear();
      this.y = null;
    }
    if (this.z != null)
    {
      this.z.clear();
      this.z = null;
    }
    if (this.g != null)
      this.g = null;
    if (this.h != null)
      this.h = null;
    if (this.N != null)
      this.N = null;
    if (this.t != null)
      this.t = null;
    if (this.u != null)
      this.u = null;
    if (this.D != null)
      this.D = null;
    if (this.s != null)
      this.s = null;
    if (this.K != null)
    {
      this.K.cancel();
      this.K = null;
    }
    this.n = null;
    this.o = null;
    this.p = null;
    this.B = null;
    this.H = null;
    this.F = null;
    this.I = null;
    this.G = null;
    this.r = null;
    com.netease.image.d.a().e();
  }

  public boolean onKeyDown(int paramInt, KeyEvent paramKeyEvent)
  {
    if (paramInt == 4)
      com.netease.pris.d.c.a(p(), 1714);
    return super.onKeyDown(paramInt, paramKeyEvent);
  }

  public boolean onOptionsItemSelected(MenuItem paramMenuItem)
  {
    switch (paramMenuItem.getItemId())
    {
    default:
    case 2131558722:
    case 2131558734:
    }
    while (true)
    {
      return super.onOptionsItemSelected(paramMenuItem);
      int i1 = this.p.av();
      a();
      if ((i1 == 512) || (i1 == 2048))
        this.v.a();
      while (true)
      {
        b();
        com.netease.pris.d.c.a(p(), 1715, "Menu");
        break;
        this.w.a();
      }
      SubsInfoActivity.a(this.r, this.p);
      com.netease.pris.d.c.a(p(), 1712);
    }
  }

  public boolean onPrepareOptionsMenu(Menu paramMenu)
  {
    paramMenu.clear();
    getMenuInflater().inflate(2131492872, paramMenu);
    MenuItem localMenuItem;
    if (paramMenu.findItem(2131558722) != null)
    {
      localMenuItem = paramMenu.findItem(2131558722);
      if (this.j)
        break label62;
    }
    label62: for (boolean bool = true; ; bool = false)
    {
      localMenuItem.setEnabled(bool);
      return super.onPrepareOptionsMenu(paramMenu);
    }
  }

  public void onResume()
  {
    super.onResume();
    while (true)
    {
      try
      {
        if ((!this.k) || (this.q == null))
          break;
        this.k = false;
        if (-1 + this.m > 0)
        {
          i1 = -1 + this.m;
          if (this.t == null)
            break label267;
          i2 = i1 + this.t.getHeaderViewsCount();
          switch (this.p.av())
          {
          case 256:
            ((t)this.x).a();
            ((t)this.x).b(this.q.h);
            if (this.t == null)
              break label273;
            this.t.setSelection(i2);
          case 1024:
          case 512:
          case 2048:
          }
        }
      }
      catch (NullPointerException localNullPointerException)
      {
        localNullPointerException.printStackTrace();
      }
      finally
      {
      }
      int i1 = this.m;
      continue;
      this.y.clear();
      this.y.addAll(this.q.h);
      this.t.setAdapter(this.x);
      this.t.setSelection(i2);
      break;
      this.y.clear();
      this.y.addAll(this.q.h);
      this.u.setAdapter(this.x);
      this.u.setSelection(i2);
      break;
      label267: int i2 = i1;
    }
    while (true)
      label273: return;
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.pris.activity.SubsSourceActivity
 * JD-Core Version:    0.6.0
 */